package 实验二;

public class Student {
	private String sId;
	private String name;
	private String gender;
	private Course sCourse;
	public Student(String sId,String name,String gender) {
		this.sId=sId;
		this.name=name;
		this.gender=gender;
	}
    public void sCourse(Course course) {
        this.sCourse = course;
        System.out.println(name + " 成功选修课程：" + course.getCName());
    }

    public void dropCourse() {
        if (sCourse != null) {
            System.out.println(name + " 成功退课：" + sCourse.getCName());
            this.sCourse = null;
        } else {
            System.out.println(name + " 暂无选课记录，无法退课！");
        }
    }

    public void printTimetable() {
        if (sCourse != null) {
            System.out.println("=== " + name + " 的课表 ===");
            System.out.println(sCourse);
        } else {
            System.out.println(name + " 暂无选课记录，课表为空！");
        }
    }

    public String getSId() { return sId; }
    public void setSId(String sId) { this.sId = sId; }

    public String getName() { return name; }
    public void setName(String name) { this.name = name; }

    public String getGender() { return gender; }
    public void setGender(String gender) { this.gender = gender; }

    public Course getSCourse() { return sCourse; }
    public void setSCourse(Course sCourse) { this.sCourse = sCourse; }
}

